// components/swiper-swiper/swiper.js
let app = getApp();
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    // 活动封面
    bannerType: String,
  },

  /**
   * 组件的初始数据
   */
  data: {
    user: null,
    bannerList: [],
  },

  lifetimes: {
    attached() {
//      this.getBanner();
     },
  },

  /**
   * 组件的方法列表
   */
  methods: {
    //请求
    getBanner(){
      let _this = this;
      let user = app.getUser();
      let tCentreId = wx.getStorageSync('tempCentreId');
     wx.request({
       url: app.globalData.deployUrl + '/wxapi/shop/banners',
       method: 'GET',
       data: {
         centerId: app.globalData.loginCentreId,
         top: 10,
         type: _this.properties.bannerType
       },
       success: (res) => {
         if (res.data.success){
           _this.setData({
             bannerList:  res.data.data
           })
         }
       }
     });
    },
    selectTab:function(event){
      console.log(event.currentTarget.dataset.info);
      let info = event.currentTarget.dataset.info;
      if(info.mediaType == 'H5'){
      
      }else if(info.mediaType == 'product'){
        wx.navigateTo({
          url: '/subIndex/index/good-item/good-item?productId=' + info.link
        })
      }else if(info.mediaType == 'otherWxxcx'){
        
      }
    }

  },
})
